//============================================================================
// Name        : pcstp.cpp
// Author      : Hugo Barbalho
// Version     :
// Copyright   : academic
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include "Instance.h"
#include "Heuristic.h"
#include "Grasp.h"
#include "Solution.h"
using namespace std;

int main(int argc, char **argv) {
	Solution *sol = NULL;
	Instance *instance = NULL;
	int type = 0;
	int pool_size=10;
	if(argc==1){
		 //instance = new Instance("../benchmark/instances/steinc10-wmax:10-seed:33000-gw.dat");
		 instance = new Instance("../benchmark/instances/steinc12-wmax:100-seed:33000-gw.dat");
		 //instance = new Instance("instances/small.dat");
		 //Heuristic *heuristic = new Heuristic(instance);
		 //heuristic->start(0);
	}else if(argc==3){
		string name(argv[1]);
		type = atoi(argv[2]);
		instance = new Instance(name);
	}else if(argc==4){
		string name(argv[1]);
		type = atoi(argv[2]);
		pool_size = atoi(argv[3]);
		instance = new Instance(name);
	}else{
		cout << "Usage: ./pcstp instance_file type [pool_size]"<<endl;
	}
	if(instance!=NULL){
	    //cout << "Cost test: "<<endl;
	    //instance->short_path_cost_test();
	    //cout << "Prize test: "<<endl;
	    //instance->short_path_prize_test();
		Grasp *grasp = new Grasp(instance,1);
		grasp->start(type,pool_size);
		printf("Time: %.5lf\n",grasp->get_time());
		printf("StdDev: %.5lf\n",grasp->get_stddev());
		grasp->get_solution()->quick_print();
		delete instance;
	}
	/*if(instance!=NULL){
		Heuristic *heuristic = new Heuristic(instance);
		heuristic->start(type);
		printf("Time: %.5lf\n",heuristic->get_time());
		printf("StdDev: %.5lf\n",heuristic->get_stddev());
		sol = heuristic->get_best();
		if(sol!=NULL)
			sol->quick_print();
			//sol->print();
	}*/
	return 0;
}
